package com.example.neusoft.yuejian.Base;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.Toast;

import com.example.neusoft.yuejian.Util.IsInternet;

public abstract class BaseActivity extends AppCompatActivity {
    public abstract int getLayoutFile();

    abstract public void initView();

    abstract public void initEvent();

    abstract public void initData();
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(getLayoutFile());
        initView();
        initEvent();
        if (!IsInternet.isNetworkAvalible(this)) {
            showToast("当前网络不可用，请检查网络设置");
        } else {
            initData();
        }
    }

    public void showToast(String msg) {
        Toast.makeText(this, msg, Toast.LENGTH_SHORT).show();
    }
}
